package com.itheima.feign.order;

import com.itheima.entity.OrderEntity;
import com.itheima.feign.fallback.OrderFeignFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * @Description: feign 接口 用于远程调用的
 * @Version: V1.0
 */
@FeignClient(value = "order-service", fallback = OrderFeignFallback.class)   // 定义feign接口
public interface OrderFeign {

    //"http://ip:port/order/findOrderInfoByUserId/1";
    // 方法定义是参考服务的提供方（order-service）的 Controller定义
    @GetMapping("/order/findOrderInfoByUserId/{userId}")
    public List<OrderEntity> findOrderInfoByUserId(@PathVariable("userId") Integer userId);


    @PostMapping("/order/findAll")
    public void findAll();
}
